package features.advance.ch3;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.*;

public class URIUtils {
    public static void main(String[] args) throws URISyntaxException, IOException {
        URI base = new URI("http://doc.mycompany.com/api");
        URI combined = new URI("http://doc.mycompany.com/api/java/lang/String.html");
        URI relativize = base.relativize(combined);
        System.out.println(relativize);
        System.out.println(base.resolve(relativize));
        System.out.println(base.getScheme());
        System.out.println(base.getSchemeSpecificPart());

        URL url = new URL("https://www.github.com");
        URLConnection connection = url.openConnection();
        connection.connect();
        InputStream inputStream = connection.getInputStream();
        int i=0;
        while ((i=inputStream.read())!=-1){
            System.out.print((char) i);
        }


    }


}
